﻿using EcommerceRabbit.API.Application.Command.Trace;
using EcommerceRabbit.Servies.traceability;
using MediatR;

namespace EcommerceRabbit.API.Application.CommandHandler.Trace
{
    public class TraceUpdateCommandHandler : IRequestHandler<TraceUpdateCommand, int>
    {
        private readonly ITraceServices services;

        public TraceUpdateCommandHandler(ITraceServices services)
        {
            this.services = services;
        }

        public Task<int> Handle(TraceUpdateCommand request, CancellationToken cancellationToken)
        {
            return services.UpdateTrace(new Ecommerce.Domain.Dto.TraceDTO() { Firm = request.Firm, Shelf = request.Shelf, Images = request.Images, license = request.license, Mid = request.Mid, TName = request.TName, GoodNo = request.GoodNo, Tid = request.Tid });
        }
    }
}
